home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 641 < prev    next >
Mailbox/MIME Entity  |  1996-08-06  |  4.4 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: Mailbox/MIME Entity (archive/mbox).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert Mailbox/MIME Entity (archive/mbox) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news text default
99% file C++ source text default
98% file C source text default
97% file C++ source, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/950 MIME Email (1.0) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 65 6e | 67 6e 65 77 73 31 2e 45 |Path: en|gnews1.E|
|00000010| 6e 67 2e 53 75 6e 2e 43 | 4f 4d 21 74 61 75 6d 65 |ng.Sun.C|OM!taume|
|00000020| 74 21 63 6c 61 6d 61 67 | 65 0a 46 72 6f 6d 3a 20 |t!clamag|e.From: |
|00000030| 56 61 6c 65 6e 74 69 6e | 20 42 6f 6e 6e 61 72 64 |Valentin| Bonnard|
|00000040| 20 3c 62 6f 6e 6e 61 72 | 64 76 40 70 72 61 74 69 | <bonnar|dv@prati|
|00000050| 71 75 65 2e 66 72 3e 0a | 4e 65 77 73 67 72 6f 75 |que.fr>.|Newsgrou|
|00000060| 70 73 3a 20 63 6f 6d 70 | 2e 73 74 64 2e 63 2b 2b |ps: comp|.std.c++|
|00000070| 0a 53 75 62 6a 65 63 74 | 3a 20 53 6f 6d 65 20 69 |.Subject|: Some i|
|00000080| 64 65 61 73 20 61 62 6f | 75 74 20 43 2b 2b 20 61 |deas abo|ut C++ a|
|00000090| 6e 64 20 61 20 71 75 65 | 73 74 69 6f 6e 0a 44 61 |nd a que|stion.Da|
|000000a0| 74 65 3a 20 33 20 4d 61 | 72 20 31 39 39 36 20 32 |te: 3 Ma|r 1996 2|
|000000b0| 33 3a 33 34 3a 30 37 20 | 47 4d 54 0a 4f 72 67 61 |3:34:07 |GMT.Orga|
|000000c0| 6e 69 7a 61 74 69 6f 6e | 3a 20 49 6e 74 65 72 6e |nization|: Intern|
|000000d0| 65 74 20 57 61 79 0a 41 | 70 70 72 6f 76 65 64 3a |et Way.A|pproved:|
|000000e0| 20 63 6c 61 6d 61 67 65 | 40 65 6e 67 2e 73 75 6e | clamage|@eng.sun|
|000000f0| 2e 63 6f 6d 20 28 63 6f | 6d 70 2e 73 74 64 2e 63 |.com (co|mp.std.c|
|00000100| 2b 2b 29 0a 4d 65 73 73 | 61 67 65 2d 49 44 3a 20 |++).Mess|age-ID: |
|00000110| 3c 34 68 39 73 6d 75 24 | 6d 32 6e 40 73 33 2e 69 |<4h9smu$|m2n@s3.i|
|00000120| 77 61 79 2e 66 72 3e 0a | 4e 4e 54 50 2d 50 6f 73 |way.fr>.|NNTP-Pos|
|00000130| 74 69 6e 67 2d 48 6f 73 | 74 3a 20 74 61 75 6d 65 |ting-Hos|t: taume|
|00000140| 74 2e 65 6e 67 2e 73 75 | 6e 2e 63 6f 6d 0a 4d 69 |t.eng.su|n.com.Mi|
|00000150| 6d 65 2d 56 65 72 73 69 | 6f 6e 3a 20 31 2e 30 0a |me-Versi|on: 1.0.|
|00000160| 43 6f 6e 74 65 6e 74 2d | 54 79 70 65 3a 20 74 65 |Content-|Type: te|
|00000170| 78 74 2f 70 6c 61 69 6e | 3b 20 63 68 61 72 73 65 |xt/plain|; charse|
|00000180| 74 3d 75 73 2d 61 73 63 | 69 69 0a 43 6f 6e 74 65 |t=us-asc|ii.Conte|
|00000190| 6e 74 2d 54 72 61 6e 73 | 66 65 72 2d 45 6e 63 6f |nt-Trans|fer-Enco|
|000001a0| 64 69 6e 67 3a 20 37 62 | 69 74 0a 58 2d 4e 6e 74 |ding: 7b|it.X-Nnt|
|000001b0| 70 2d 50 6f 73 74 69 6e | 67 2d 48 6f 73 74 3a 20 |p-Postin|g-Host: |
|000001c0| 74 73 31 2d 70 32 32 2e | 64 69 61 6c 75 70 2e 69 |ts1-p22.|dialup.i|
|000001d0| 77 61 79 2e 66 72 0a 58 | 2d 4d 61 69 6c 65 72 3a |way.fr.X|-Mailer:|
|000001e0| 20 4d 6f 7a 69 6c 6c 61 | 20 31 2e 31 4e 20 28 4d | Mozilla| 1.1N (M|
|000001f0| 61 63 69 6e 74 6f 73 68 | 3b 20 49 3b 20 36 38 4b |acintosh|; I; 68K|
|00000200| 29 0a 54 6f 3a 20 72 69 | 63 68 40 72 63 73 2d 68 |).To: ri|ch@rcs-h|
|00000210| 71 2e 6d 68 73 2e 63 6f | 6d 70 75 73 65 72 76 65 |q.mhs.co|mpuserve|
|00000220| 2e 63 6f 6d 0a 58 2d 55 | 72 6c 3a 20 6e 65 77 73 |.com.X-U|rl: news|
|00000230| 3a 63 6f 6d 70 2e 73 74 | 64 2e 63 2b 2b 23 34 68 |:comp.st|d.c++#4h|
|00000240| 34 6f 69 76 24 34 6d 64 | 40 78 61 6e 61 64 75 2e |4oiv$4md|@xanadu.|
|00000250| 69 6f 2e 63 6f 6d 0a 43 | 6f 6e 74 65 6e 74 2d 4c |io.com.C|ontent-L|
|00000260| 65 6e 67 74 68 3a 20 33 | 35 30 35 0a 4f 72 69 67 |ength: 3|505.Orig|
|00000270| 69 6e 61 74 6f 72 3a 20 | 63 6c 61 6d 61 67 65 40 |inator: |clamage@|
|00000280| 74 61 75 6d 65 74 0a 0a | 49 20 68 61 76 65 20 34 |taumet..|I have 4|
|00000290| 20 69 64 65 61 73 20 61 | 62 6f 75 74 20 43 2b 2b | ideas a|bout C++|
|000002a0| 20 61 6e 64 20 61 20 71 | 75 65 73 74 69 6f 6e 2e | and a q|uestion.|
|000002b0| 0a 0a 0a 31 29 20 53 74 | 72 69 6e 67 20 6c 69 74 |...1) St|ring lit|
|000002c0| 65 72 61 6c 73 0a 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |erals.~~|~~~~~~~~|
|000002d0| 7e 7e 7e 7e 7e 7e 7e 7e | 0a 53 74 72 69 6e 67 20 |~~~~~~~~|.String |
|000002e0| 6c 69 74 65 72 61 6c 73 | 20 73 68 6f 75 6c 64 20 |literals| should |
|000002f0| 62 65 20 63 6f 6e 73 74 | 20 63 68 61 72 2a 20 69 |be const| char* i|
|00000300| 6e 73 74 65 61 64 20 6f | 66 20 63 68 61 72 2a 20 |nstead o|f char* |
|00000310| 28 69 66 20 69 74 20 69 | 73 20 6e 6f 74 0a 61 6c |(if it i|s not.al|
|00000320| 72 65 61 64 79 20 74 68 | 65 20 63 61 73 65 29 2e |ready th|e case).|
|00000330| 0a 0a 0a 32 29 20 50 6c | 61 63 65 6d 65 6e 74 20 |...2) Pl|acement |
|00000340| 6f 70 65 72 61 74 6f 72 | 73 0a 7e 7e 7e 7e 7e 7e |operator|s.~~~~~~|
|00000350| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000360| 0a 63 6c 61 73 73 20 4f | 62 6a 65 63 74 20 7b 0a |.class O|bject {.|
|00000370| 20 20 20 20 20 20 20 20 | 76 6f 69 64 20 20 20 20 | |void |
|00000380| 6f 70 65 72 61 74 6f 72 | 2b 20 2f 2f 20 6f 72 20 |operator|+ // or |
|00000390| 2f 20 6f 72 20 77 68 61 | 74 65 76 65 72 0a 20 20 |/ or wha|tever. |
|000003a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000003b0| 20 20 20 20 20 20 20 28 | 4f 62 6a 65 63 74 26 20 | (|Object& |
|000003c0| 72 65 73 75 6c 74 2c 20 | 63 6f 6e 73 74 20 4f 62 |result, |const Ob|
|000003d0| 6a 65 63 74 26 20 62 29 | 20 63 6f 6e 73 74 3b 0a |ject& b)| const;.|
|000003e0| 20 20 20 20 20 20 20 20 | 76 6f 69 64 20 20 20 20 | |void |
|000003f0| 6f 70 65 72 61 74 6f 72 | 2a 20 28 4f 62 6a 65 63 |operator|* (Objec|
|00000400| 74 26 20 72 65 73 75 6c | 74 29 20 63 6f 6e 73 74 |t& resul|t) const|
|00000410| 3b 0a 20 20 20 20 20 20 | 20 20 4f 62 6a 65 63 74 |;. | Object|
|00000420| 20 20 6f 70 65 72 61 74 | 6f 72 2a 20 28 63 6f 6e | operat|or* (con|
|00000430| 73 74 20 4f 62 6a 65 63 | 74 26 20 72 65 73 75 6c |st Objec|t& resul|
|00000440| 74 29 20 63 6f 6e 73 74 | 3b 20 2f 2f 20 6f 6c 64 |t) const|; // old|
|00000450| 20 6f 6e 65 0a 7d 0a 0a | 73 68 6f 75 6c 64 20 62 | one.}..|should b|
|00000460| 65 20 63 61 6c 6c 65 64 | 20 72 65 73 70 65 63 74 |e called| respect|
|00000470| 69 76 65 6c 79 20 62 79 | 3a 0a 61 20 3d 20 62 20 |ively by|:.a = b |
|00000480| 2b 20 63 3b 0a 0a 61 6e | 64 20 61 20 3d 20 2a 62 |+ c;..an|d a = *b|
|00000490| 3b 0a 0a 61 6e 64 20 28 | 6f 6c 64 20 6f 6e 65 29 |;..and (|old one)|
|000004a0| 20 61 2a 62 3b 0a 0a 54 | 68 69 73 20 77 69 6c 6c | a*b;..T|his will|
|000004b0| 20 73 6f 6c 76 65 20 74 | 68 65 20 5b 77 65 6c 6c | solve t|he [well|
|000004c0| 2d 6b 6e 6f 77 6e 5d 20 | 70 72 6f 62 6c 65 6d 20 |-known] |problem |
|000004d0| 6f 66 20 63 6f 70 79 69 | 6e 67 20 74 68 65 20 72 |of copyi|ng the r|
|000004e0| 65 73 75 6c 74 20 69 6e | 74 6f 20 61 20 74 65 6d |esult in|to a tem|
|000004f0| 70 6f 72 61 72 79 2e 0a | 54 68 65 20 63 6f 6d 70 |porary..|The comp|
|00000500| 61 74 69 62 69 6c 69 74 | 79 20 77 69 6c 6c 20 62 |atibilit|y will b|
|00000510| 65 20 70 72 65 73 65 72 | 76 65 64 20 73 69 6e 63 |e preser|ved sinc|
|00000520| 65 20 6f 6c 64 20 73 79 | 6e 74 61 78 20 77 69 6c |e old sy|ntax wil|
|00000530| 6c 20 62 65 20 61 6c 6c | 6f 77 65 64 20 74 6f 2e |l be all|owed to.|
|00000540| 0a 0a 33 29 20 55 73 65 | 20 6f 66 20 65 78 70 6c |..3) Use| of expl|
|00000550| 69 63 69 74 20 6b 65 79 | 77 6f 72 64 0a 7e 7e 7e |icit key|word.~~~|
|00000560| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000570| 7e 7e 7e 7e 7e 7e 7e 0a | 2f 2f 3d 3d 3d 3d 3d 3d |~~~~~~~.|//======|
|00000580| 3d 3d 3d 20 54 65 73 74 | 2e 68 20 3d 3d 3d 3d 3d |=== Test|.h =====|
|00000590| 3d 3d 3d 3d 0a 63 6c 61 | 73 73 20 42 61 73 65 20 |====.cla|ss Base |
|000005a0| 7b 0a 20 20 20 20 70 75 | 62 6c 69 63 3a 0a 20 20 |{. pu|blic:. |
|000005b0| 20 20 20 20 20 20 76 69 | 72 74 75 61 6c 20 76 6f | vi|rtual vo|
|000005c0| 69 64 20 56 69 72 74 75 | 61 6c 46 75 6e 63 20 28 |id Virtu|alFunc (|
|000005d0| 29 3b 0a 7d 3b 0a 0a 63 | 6c 61 73 73 20 44 65 72 |);.};..c|lass Der|
|000005e0| 69 76 65 64 20 3a 20 70 | 75 62 6c 69 63 20 42 61 |ived : p|ublic Ba|
|000005f0| 73 65 20 7b 0a 20 20 20 | 20 70 75 62 6c 69 63 3a |se {. | public:|
|00000600| 0a 20 20 20 20 20 20 20 | 20 76 6f 69 64 20 56 69 |. | void Vi|
|00000610| 72 74 75 61 6c 46 75 6e | 63 20 28 29 20 7b 20 7d |rtualFun|c () { }|
|00000620| 0a 7d 3b 0a 0a 2f 2f 3d | 3d 3d 3d 3d 3d 3d 3d 3d |.};..//=|========|
|00000630| 20 43 61 6c 6c 65 72 2e | 63 70 20 3d 3d 3d 3d 3d | Caller.|cp =====|
|00000640| 3d 3d 3d 3d 0a 23 69 6e | 63 6c 75 64 65 20 3c 54 |====.#in|clude <T|
|00000650| 65 73 74 2e 68 3e 0a 63 | 6c 61 73 73 20 44 65 72 |est.h>.c|lass Der|
|00000660| 69 76 65 64 32 20 3a 20 | 70 75 62 6c 69 63 20 44 |ived2 : |public D|
|00000670| 65 72 69 76 65 64 20 7b | 0a 20 20 20 20 70 75 62 |erived {|. pub|
|00000680| 6c 69 63 3a 0a 20 20 20 | 20 20 20 20 20 76 6f 69 |lic:. | voi|
|00000690| 64 20 56 69 72 74 75 61 | 6c 46 75 6e 63 20 28 29 |d Virtua|lFunc ()|
|000006a0| 3b 0a 7d 3b 0a 0a 2f 2f | 3d 3d 3d 3d 3d 3d 3d 3d |;.};..//|========|
|000006b0| 3d 20 46 6f 6f 2e 63 70 | 20 3d 3d 3d 3d 3d 3d 3d |= Foo.cp| =======|
|000006c0| 3d 3d 0a 23 69 6e 63 6c | 75 64 65 20 3c 54 65 73 |==.#incl|ude <Tes|
|000006d0| 74 2e 68 3e 0a 0a 76 6f | 69 64 20 20 20 20 66 6f |t.h>..vo|id fo|
|000006e0| 6f 20 28 65 78 70 6c 69 | 63 69 74 20 44 65 72 69 |o (expli|cit Deri|
|000006f0| 76 65 64 2a 20 6f 62 6a | 65 63 74 29 0a 7b 0a 20 |ved* obj|ect).{. |
|00000700| 20 20 20 6f 62 6a 65 63 | 74 2e 56 69 72 74 75 61 | objec|t.Virtua|
|00000710| 6c 46 75 6e 63 20 28 29 | 3b 20 2f 2f 20 6e 6f 70 |lFunc ()|; // nop|
|00000720| 20 28 63 6f 6d 70 69 6c | 65 72 20 64 6f 65 73 20 | (compil|er does |
|00000730| 6e 6f 74 20 67 65 6e 65 | 72 61 74 65 20 63 6f 64 |not gene|rate cod|
|00000740| 65 20 66 6f 72 20 74 68 | 69 73 29 0a 0a 20 20 20 |e for th|is).. |
|00000750| 20 44 65 72 69 76 65 64 | 2a 20 41 6e 79 44 65 72 | Derived|* AnyDer|
|00000760| 69 76 65 64 4f 62 6a 65 | 63 74 20 3d 20 6f 62 6a |ivedObje|ct = obj|
|00000770| 65 63 74 3b 20 2f 2f 20 | 6f 6b 0a 7d 0a 0a 76 6f |ect; // |ok.}..vo|
|00000780| 69 64 20 20 20 20 66 6f | 6f 32 20 28 44 65 72 69 |id fo|o2 (Deri|
|00000790| 76 65 64 2a 20 6f 62 6a | 65 63 74 29 0a 7b 0a 20 |ved* obj|ect).{. |
|000007a0| 20 20 20 6f 62 6a 65 63 | 74 2e 56 69 72 74 75 61 | objec|t.Virtua|
|000007b0| 6c 46 75 6e 63 20 28 29 | 3b 20 2f 2f 20 6f 62 6a |lFunc ()|; // obj|
|000007c0| 65 63 74 20 63 61 6e 20 | 62 65 20 44 65 72 69 76 |ect can |be Deriv|
|000007d0| 65 64 32 0a 0a 20 20 20 | 20 65 78 70 6c 69 63 69 |ed2.. | explici|
|000007e0| 74 20 44 65 72 69 76 65 | 64 2a 20 52 65 61 6c 44 |t Derive|d* RealD|
|000007f0| 65 72 69 76 65 64 4f 62 | 6a 65 63 74 20 3d 20 6f |erivedOb|ject = o|
|00000800| 62 6a 65 63 74 3b 20 2f | 2f 20 65 72 72 6f 72 0a |bject; /|/ error.|
|00000810| 7d 0a 0a 54 68 65 20 6d | 65 61 6e 69 6e 67 20 6f |}..The m|eaning o|
|00000820| 66 20 65 78 70 6c 69 63 | 69 74 20 63 6f 75 6c 64 |f explic|it could|
|00000830| 20 62 65 3a 20 77 68 69 | 6c 65 20 61 20 64 65 72 | be: whi|le a der|
|00000840| 69 76 65 64 20 63 6c 61 | 73 73 20 70 74 72 20 5b |ived cla|ss ptr [|
|00000850| 72 65 73 70 2e 20 72 65 | 66 5d 20 63 61 6e 20 62 |resp. re|f] can b|
|00000860| 65 0a 63 6f 6e 76 65 72 | 74 20 74 6f 20 61 20 62 |e.conver|t to a b|
|00000870| 61 73 65 20 63 6c 61 73 | 73 20 70 74 72 20 5b 72 |ase clas|s ptr [r|
|00000880| 65 66 5d 2c 20 69 74 20 | 63 61 6e 27 74 20 62 65 |ef], it |can't be|
|00000890| 20 63 6f 6e 76 65 72 74 | 65 64 20 74 6f 20 61 20 | convert|ed to a |
|000008a0| 62 61 73 65 20 63 6c 61 | 73 73 20 0a 65 78 70 6c |base cla|ss .expl|
|000008b0| 69 63 69 74 20 70 74 72 | 20 5b 72 65 66 5d 2e 0a |icit ptr| [ref]..|
|000008c0| 0a 53 6f 20 65 78 70 6c | 69 63 69 74 20 77 6f 75 |.So expl|icit wou|
|000008d0| 6c 64 20 62 65 20 61 20 | 74 79 70 65 20 71 75 61 |ld be a |type qua|
|000008e0| 6c 69 66 69 65 72 3b 20 | 74 68 69 73 20 75 73 61 |lifier; |this usa|
|000008f0| 67 65 20 69 73 20 64 69 | 66 66 65 72 65 6e 74 20 |ge is di|fferent |
|00000900| 77 69 74 68 3a 0a 0a 3e | 20 52 69 63 68 20 48 69 |with:..>| Rich Hi|
|00000910| 63 6b 65 79 0a 3e 20 72 | 69 63 68 40 72 63 73 2d |ckey.> r|ich@rcs-|
|00000920| 68 71 2e 6d 68 73 2e 63 | 6f 6d 70 75 73 65 72 76 |hq.mhs.c|ompuserv|
|00000930| 65 2e 63 6f 6d 0a 0a 3e | 20 49 20 70 72 6f 70 6f |e.com..>| I propo|
|00000940| 73 65 20 74 68 61 74 20 | 74 68 65 20 65 78 70 6c |se that |the expl|
|00000950| 69 63 69 74 20 6b 65 79 | 77 6f 72 64 20 62 65 20 |icit key|word be |
|00000960| 61 6c 6c 6f 77 65 64 20 | 61 73 20 61 20 71 75 61 |allowed |as a qua|
|00000970| 6c 69 66 69 65 72 20 6f | 66 20 61 20 63 6c 61 73 |lifier o|f a clas|
|00000980| 73 0a 3e 20 64 65 66 69 | 6e 69 74 69 6f 6e 2c 20 |s.> defi|nition, |
|00000990| 73 75 63 68 20 71 75 61 | 6c 69 66 69 63 61 74 69 |such qua|lificati|
|000009a0| 6f 6e 20 74 61 6b 69 6e | 67 20 74 68 65 20 66 6f |on takin|g the fo|
|000009b0| 72 6d 20 6f 66 3a 0a 0a | 3e 20 65 78 70 6c 69 63 |rm of:..|> explic|
|000009c0| 69 74 20 63 6c 61 73 73 | 20 58 7b 0a 3e 20 20 20 |it class| X{.> |
|000009d0| 2f 2f 74 68 65 20 64 65 | 66 69 6e 69 74 69 6f 6e |//the de|finition|
|000009e0| 20 6f 66 20 58 0a 3e 20 | 20 20 7d 3b 0a 0a 48 65 | of X.> | };..He|
|000009f0| 72 65 2c 20 58 20 63 61 | 6e 6e 6f 74 20 62 65 20 |re, X ca|nnot be |
|00000a00| 64 65 72 69 76 65 64 20 | 62 75 74 20 6d 79 20 44 |derived |but my D|
|00000a10| 65 72 69 76 65 64 20 63 | 61 6e 20 62 65 20 73 6f |erived c|an be so|
|00000a20| 20 49 20 74 68 69 6e 6b | 20 6d 79 20 69 64 65 61 | I think| my idea|
|00000a30| 20 69 73 20 62 65 74 74 | 65 72 0a 28 70 6c 65 61 | is bett|er.(plea|
|00000a40| 73 65 20 66 65 6c 6c 20 | 66 72 65 65 20 63 6f 6d |se fell |free com|
|00000a50| 6d 65 6e 74 2f 63 72 69 | 74 69 63 69 73 65 20 74 |ment/cri|ticise t|
|00000a60| 68 69 73 20 61 73 73 65 | 72 74 69 6f 6e 29 2e 0a |his asse|rtion)..|
|00000a70| 0a 0a 34 29 20 43 6f 6e | 76 65 72 73 69 6f 6e 20 |..4) Con|version |
|00000a80| 6f 66 20 54 79 70 65 2a | 2a 20 74 6f 20 63 6f 6e |of Type*|* to con|
|00000a90| 73 74 20 54 79 70 65 2a | 2a 0a 7e 7e 7e 7e 7e 7e |st Type*|*.~~~~~~|
|00000aa0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000ab0| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000ac0| 7e 0a 0a 49 74 27 73 20 | 6f 6b 2c 20 74 68 69 73 |~..It's |ok, this|
|00000ad0| 20 69 73 20 61 6e 20 65 | 72 72 6f 72 3b 20 62 75 | is an e|rror; bu|
|00000ae0| 74 20 77 68 79 20 63 61 | 6e 6e 6f 74 20 54 79 70 |t why ca|nnot Typ|
|00000af0| 65 2a 2a 20 62 65 20 63 | 6f 6e 76 65 72 74 65 64 |e** be c|onverted|
|00000b00| 20 74 6f 20 63 6f 6e 73 | 74 20 54 79 70 65 2a 20 | to cons|t Type* |
|00000b10| 0a 63 6f 6e 73 74 2a 20 | 3f 0a 0a 76 6f 69 64 20 |.const* |?..void |
|00000b20| 20 20 20 66 6f 6f 20 28 | 29 0a 7b 0a 20 20 20 20 | foo (|).{. |
|00000b30| 74 79 70 65 64 65 66 20 | 69 6e 74 20 54 79 70 65 |typedef |int Type|
|00000b40| 3b 0a 20 20 20 20 54 79 | 70 65 20 20 20 20 20 20 |;. Ty|pe |
|00000b50| 20 20 69 3b 0a 20 20 20 | 20 63 6f 6e 73 74 20 54 | i;. | const T|
|00000b60| 79 70 65 20 20 63 69 20 | 3d 20 32 3b 0a 20 20 20 |ype ci |= 2;. |
|00000b70| 20 54 79 70 65 2a 20 20 | 20 20 20 20 20 70 69 20 | Type* | pi |
|00000b80| 3d 20 26 69 3b 0a 20 20 | 20 20 54 79 70 65 2a 2a |= &i;. | Type**|
|00000b90| 20 20 20 20 20 20 70 70 | 69 20 3d 20 26 70 69 3b | pp|i = &pi;|
|00000ba0| 0a 0a 20 20 20 20 63 6f | 6e 73 74 20 54 79 70 65 |.. co|nst Type|
|00000bb0| 2a 2a 20 70 70 63 69 20 | 3d 20 70 70 69 3b 20 20 |** ppci |= ppi; |
|00000bc0| 20 20 20 20 20 20 20 20 | 20 20 2f 2f 20 65 72 72 | | // err|
|00000bd0| 6f 72 20 62 65 63 61 75 | 73 65 0a 20 20 20 20 2a |or becau|se. *|
|00000be0| 70 70 63 69 20 3d 20 26 | 63 69 3b 20 20 20 20 20 |ppci = &|ci; |
|00000bf0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000c00| 20 20 20 2f 2f 20 6e 6f | 77 20 70 69 20 3d 3d 20 | // no|w pi == |
|00000c10| 26 63 69 0a 20 20 20 20 | 2a 70 69 20 3d 20 30 3b |&ci. |*pi = 0;|
|00000c20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000c30| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2f 20 61 | | // a|
|00000c40| 6e 64 20 6e 6f 77 20 77 | 65 20 6d 6f 64 69 66 79 |nd now w|e modify|
|00000c50| 20 63 69 0a 0a 20 20 20 | 20 63 6f 6e 73 74 20 54 | ci.. | const T|
|00000c60| 79 70 65 2a 63 6f 6e 73 | 74 2a 20 70 63 70 63 69 |ype*cons|t* pcpci|
|00000c70| 20 3d 20 70 70 69 3b 20 | 20 20 20 20 20 2f 2f 20 | = ppi; | // |
|00000c80| 6e 6f 20 70 72 6f 62 6c | 65 6d 20 62 65 63 61 75 |no probl|em becau|
|00000c90| 73 65 0a 20 20 20 20 2a | 70 63 70 63 69 20 3d 20 |se. *|pcpci = |
|00000ca0| 26 63 69 3b 20 20 20 20 | 20 20 20 20 20 20 20 20 |&ci; | |
|00000cb0| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2f 20 74 68 | | // th|
|00000cc0| 69 73 20 69 73 20 69 6d | 70 6f 73 73 69 62 6c 65 |is is im|possible|
|00000cd0| 20 28 73 69 6e 63 65 20 | 2a 70 63 70 63 69 20 69 | (since |*pcpci i|
|00000ce0| 73 20 0a 63 6f 6e 73 74 | 29 0a 7d 0a 0a 0a 4e 6f |s .const|).}...No|
|00000cf0| 77 20 61 20 71 75 65 73 | 74 69 6f 6e 3a 0a 0a 57 |w a ques|tion:..W|
|00000d00| 69 6c 6c 20 74 68 65 72 | 65 20 62 65 20 61 6e 79 |ill ther|e be any|
|00000d10| 20 77 61 79 20 74 6f 20 | 72 65 64 65 66 69 6e 65 | way to |redefine|
|00000d20| 20 28 6f 76 65 72 6c 6f | 61 64 29 20 6e 6f 72 6d | (overlo|ad) norm|
|00000d30| 61 6c 20 26 26 20 6f 72 | 20 7c 7c 20 6f 6e 20 63 |al && or| || on c|
|00000d40| 6c 61 73 73 20 3f 0a 7e | 7e 7e 7e 7e 7e 7e 7e 7e |lass ?.~|~~~~~~~~|
|00000d50| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000d60| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000d70| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 7e 7e |~~~~~~~~|~~~~~~~~|
|00000d80| 7e 7e 7e 7e 7e 7e 7e 7e | 7e 7e 7e 7e 7e 7e 0a 0a |~~~~~~~~|~~~~~~..|
|00000d90| 49 20 6d 65 61 6e 2c 20 | 6e 6f 77 3a 0a 0a 63 6c |I mean, |now:..cl|
|00000da0| 61 73 73 20 49 6e 74 20 | 7b 0a 20 20 20 20 70 75 |ass Int |{. pu|
|00000db0| 62 6c 69 63 3a 0a 20 20 | 20 20 20 20 20 20 6f 70 |blic:. | op|
|00000dc0| 65 72 61 74 6f 72 20 69 | 6e 74 20 28 29 20 63 6f |erator i|nt () co|
|00000dd0| 6e 73 74 20 7b 20 72 65 | 74 75 72 6e 20 69 3b 20 |nst { re|turn i; |
|00000de0| 7d 0a 20 20 20 20 20 20 | 20 20 6f 70 65 72 61 74 |}. | operat|
|00000df0| 6f 72 20 26 26 20 28 69 | 6e 74 29 20 63 6f 6e 73 |or && (i|nt) cons|
|00000e00| 74 3b 0a 20 20 20 20 20 | 20 20 20 6f 70 65 72 61 |t;. | opera|
|00000e10| 74 6f 72 20 7c 7c 20 28 | 69 6e 74 29 20 63 6f 6e |tor || (|int) con|
|00000e20| 73 74 3b 0a 20 20 20 20 | 20 20 20 20 49 6e 74 20 |st;. | Int |
|00000e30| 28 69 6e 74 20 49 29 20 | 3a 20 69 28 49 29 20 7b |(int I) |: i(I) {|
|00000e40| 20 7d 0a 0a 20 20 20 20 | 70 72 69 76 61 74 65 3a | }.. |private:|
|00000e50| 0a 20 20 20 20 20 20 20 | 20 69 6e 74 20 20 20 20 |. | int |
|00000e60| 20 69 3b 0a 7d 3b 0a 0a | 69 6e 74 20 20 20 20 20 | i;.};..|int |
|00000e70| 46 75 6e 63 20 28 29 0a | 7b 0a 20 20 20 20 63 6f |Func ().|{. co|
|00000e80| 75 74 20 3c 3c 20 22 63 | 61 6c 6c 65 64 5c 6e 22 |ut << "c|alled\n"|
|00000e90| 3b 0a 20 20 20 20 72 65 | 74 75 72 6e 20 31 3b 0a |;. re|turn 1;.|
|00000ea0| 7d 0a 0a 76 6f 69 64 20 | 20 20 20 66 6f 6f 20 28 |}..void | foo (|
|00000eb0| 29 0a 7b 0a 20 20 20 20 | 69 6e 74 20 69 20 28 31 |).{. |int i (1|
|00000ec0| 29 3b 0a 20 20 20 20 49 | 6e 74 20 49 20 28 31 29 |);. I|nt I (1)|
|00000ed0| 3b 0a 0a 20 20 20 20 69 | 66 20 28 69 20 7c 7c 20 |;.. i|f (i || |
|00000ee0| 46 75 6e 63 20 28 29 29 | 20 2f 2f 20 63 61 6c 6c |Func ())| // call|
|00000ef0| 65 64 20 69 73 20 6e 6f | 74 20 70 72 69 6e 74 65 |ed is no|t printe|
|00000f00| 64 0a 20 20 20 20 20 20 | 20 20 3b 0a 20 20 20 20 |d. | ;. |
|00000f10| 69 66 20 28 49 20 7c 7c | 20 46 75 6e 63 20 28 29 |if (I ||| Func ()|
|00000f20| 29 20 2f 2f 20 63 61 6c | 6c 65 64 20 69 73 20 70 |) // cal|led is p|
|00000f30| 72 69 6e 74 65 64 0a 20 | 20 20 20 20 20 20 20 3b |rinted. | ;|
|00000f40| 0a 7d 0a 0a 4f 6e 65 20 | 63 6f 75 6c 64 20 74 68 |.}..One |could th|
|00000f50| 69 6e 6b 20 74 68 61 74 | 20 74 68 65 20 73 74 61 |ink that| the sta|
|00000f60| 6e 64 61 72 64 20 73 68 | 6f 75 6c 64 20 62 65 20 |ndard sh|ould be |
|00000f70| 63 68 61 6e 67 65 20 69 | 6e 20 6f 72 64 65 72 20 |change i|n order |
|00000f80| 74 6f 20 73 75 70 70 6f | 72 74 20 72 65 61 6c 0a |to suppo|rt real.|
|00000f90| 6f 76 65 72 6c 6f 61 64 | 65 64 20 6f 70 65 72 61 |overload|ed opera|
|00000fa0| 74 6f 72 20 26 26 20 61 | 6e 64 20 7c 7c 2e 0a 0a |tor && a|nd ||...|
|00000fb0| 49 20 63 61 6e 27 74 20 | 73 65 65 20 74 68 65 20 |I can't |see the |
|00000fc0| 70 6f 69 6e 74 20 6f 66 | 20 64 6f 69 6e 67 20 74 |point of| doing t|
|00000fd0| 68 61 74 2c 20 73 6f 20 | 69 66 20 69 74 27 73 20 |hat, so |if it's |
|00000fe0| 74 68 65 20 63 61 73 65 | 20 66 6f 72 20 79 6f 75 |the case| for you|
|00000ff0| 20 74 6f 20 64 6f 6e 27 | 74 20 61 73 6b 0a 6d 65 | to don'|t ask.me|
|00001000| 20 6e 6f 72 20 63 72 69 | 74 69 63 69 73 65 2e 0a | nor cri|ticise..|
|00001010| 0a 56 61 6c 65 6e 74 69 | 6e 20 42 6f 6e 6e 61 72 |.Valenti|n Bonnar|
|00001020| 64 0a 62 6f 6e 6e 61 72 | 64 76 40 70 72 61 74 69 |d.bonnar|dv@prati|
|00001030| 71 75 65 2e 66 72 0a 0a | 0a 0a 0a 5b 20 63 6f 6d |que.fr..|...[ com|
|00001040| 70 2e 73 74 64 2e 63 2b | 2b 20 69 73 20 6d 6f 64 |p.std.c+|+ is mod|
|00001050| 65 72 61 74 65 64 2e 20 | 20 54 6f 20 73 75 62 6d |erated. | To subm|
|00001060| 69 74 20 61 72 74 69 63 | 6c 65 73 3a 20 54 72 79 |it artic|les: Try|
|00001070| 20 6a 75 73 74 20 70 6f | 73 74 69 6e 67 20 77 69 | just po|sting wi|
|00001080| 74 68 20 79 6f 75 72 0a | 20 20 20 20 20 20 20 20 |th your.| |
|00001090| 20 20 20 20 20 20 20 20 | 6e 65 77 73 72 65 61 64 | |newsread|
|000010a0| 65 72 2e 20 20 49 66 20 | 74 68 61 74 20 66 61 69 |er. If |that fai|
|000010b0| 6c 73 2c 20 75 73 65 20 | 6d 61 69 6c 74 6f 3a 73 |ls, use |mailto:s|
|000010c0| 74 64 2d 63 2b 2b 40 6e | 63 61 72 2e 75 63 61 72 |td-c++@n|car.ucar|
|000010d0| 2e 65 64 75 0a 20 20 63 | 6f 6d 70 2e 73 74 64 2e |.edu. c|omp.std.|
|000010e0| 63 2b 2b 20 46 41 51 3a | 20 68 74 74 70 3a 2f 2f |c++ FAQ:| http://|
|000010f0| 72 65 61 6c 69 74 79 2e | 73 67 69 2e 63 6f 6d 2f |reality.|sgi.com/|
|00001100| 61 75 73 74 65 72 6e 2f | 73 74 64 2d 63 2b 2b 2f |austern/|std-c++/|
|00001110| 66 61 71 2e 68 74 6d 6c | 0a 20 20 4d 6f 64 65 72 |faq.html|. Moder|
|00001120| 61 74 69 6f 6e 20 70 6f | 6c 69 63 79 3a 20 68 74 |ation po|licy: ht|
|00001130| 74 70 3a 2f 2f 72 65 61 | 6c 69 74 79 2e 73 67 69 |tp://rea|lity.sgi|
|00001140| 2e 63 6f 6d 2f 61 75 73 | 74 65 72 6e 2f 73 74 64 |.com/aus|tern/std|
|00001150| 2d 63 2b 2b 2f 70 6f 6c | 69 63 79 2e 68 74 6d 6c |-c++/pol|icy.html|
|00001160| 0a 20 20 43 6f 6d 6d 65 | 6e 74 73 3f 20 6d 61 69 |. Comme|nts? mai|
|00001170| 6c 74 6f 3a 73 74 64 2d | 63 2b 2b 2d 72 65 71 75 |lto:std-|c++-requ|
|00001180| 65 73 74 40 6e 63 61 72 | 2e 75 63 61 72 2e 65 64 |est@ncar|.ucar.ed|
|00001190| 75 0a 5d 0a | |u.]. | |
+--------+-------------------------+-------------------------+--------+--------+